<template>
  <div class="shop">
    <div
      class="item"
      v-for="item in list"
      :key="item.id"
      @click="
        $router.push({
          path: '/shopDetail',
          query: { id: item.id },
        })
      "
    >
      <div class="img"><img :src="baseImg + item.image_path" alt="" /></div>
      <div class="content">
        <div class="header">
          <h4 class="ellipsis">{{ item.name }}</h4>
          <ul class="shop_detail_ul">
            <li class="supports">保</li>
            <li class="supports">准</li>
            <li class="supports">票</li>
          </ul>
        </div>
        <div class="content_main">
          <div class="left">
            <van-rate
              v-model="item.rating"
              allow-half
              void-icon="star"
              void-color="#eee"
              color="#fe9b11"
              :size="13"
            />
            <span>{{ item.rating }}</span>
            <em>月售106单</em>
          </div>
          <div class="right">
            <span class="fn">蜂鸟配送</span>
            <span class="zs">准时达</span>
          </div>
        </div>
        <div class="footer">
          <p class="left">
            ￥{{ item.float_minimum_order_amount }}起送/{{
              item.piecewise_agent_fee.tips
            }}
          </p>
          <p class="right">
            {{ item.distance }}/<em>{{ item.order_lead_time }}</em>
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import axios from "@/utils/request";
export default {
  props: {
    list: Array,
  },
  data() {
    return {
      baseImg: axios.defaults.baseURL + "/img/",
    };
  },
};
</script>

<style lang="less" scoped>
.shop {
  margin-top: 10px;
  background-color: #fff;
  .item {
    display: flex;
    padding: 10px;
    border-bottom: 1px solid #ccc;
    .img {
      width: 80px;
      img {
        width: 100%;
      }
    }
    .content {
      flex: 1;
      margin-left: 10px;
      .header {
        display: flex;
        justify-content: space-between;
        h4 {
          width: 204px;
          color: #333;
          padding-top: 0.01rem;
          font: 15.6px/15.6px PingFangSC-Regular;
          font-weight: 700;
          &::before {
            content: "品牌";
            display: inline-block;
            font-size: 0.5rem;
            line-height: 0.6rem;
            color: #333;
            background-color: #ffd930;
            padding: 0 0.1rem;
            border-radius: 0.1rem;
            margin-right: 0.2rem;
          }
        }
        .shop_detail_ul {
          display: flex;
          transform: scale(0.8);
          margin-right: -7px;
          .supports {
            font-size: 12px;
            color: #999;
            border: 0.6px solid #f1f1f1;
            padding: 0 0.96px;
            border-radius: 1.92px;
            margin-left: 1.2px;
          }
        }
      }
      .content_main {
        display: flex;
        justify-content: space-between;
        margin: 20px 0;
        .left {
          span {
            color: #ff8e70;
            margin: 0 6px;
          }
          em {
            font-size: 12px;
            color: #666;
          }
        }
        .right {
          transform: scale(0.7);
          margin-right: -0.9rem;
          span {
            font-size: 2px;
            padding: 1px 1px 0;
            border-radius: 2px;
            margin-left: 2px;
          }
          .fn {
            color: #fff;
            background-color: #3190e8;
            border: 0.025rem solid #3190e8;
          }
          .zs {
            color: #3190e8;
            border: 0.025rem solid #3190e8;
          }
        }
      }
      .footer {
        display: flex;
        justify-content: space-between;
        font-size: 12px;
        color: #666;
        .left {
          margin-left: -0.8rem;
          transform: scale(0.9);
        }
        .right {
          em {
            color: #3190e8;
          }
        }
      }
    }
  }
}
</style>